package com.dubbo.config;

import com.dubbo.service.PrividerMessageService;
import org.apache.dubbo.config.spring.ReferenceBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

/**
 * @ Author xsd
 * @ crate time 2020/6/28 16:03
 * @ 描述 rpc bean
 * 参考： http://dubbo.apache.org/zh-cn/docs/user/configuration/api.html
 *  zj: ReferenceBean  Aop可进行切面
 *     ls /dubbo/com.dubbo.service.PrividerMessageService/providers
 *        固定节点+下边的临时节点_服务挂掉、临时节点立即消失
 */
@Configuration
public class DubboReferenceBean {

    @Bean
    @Primary
    public ReferenceBean<PrividerMessageService> persistenceCoreServiceReferenceBean() {
        ReferenceBean<PrividerMessageService> ref = new ReferenceBean<>();
        ref.setVersion("1.0.0");
        ref.setInterface(PrividerMessageService.class);
        ref.setTimeout(60000);
        ref.setRetries(1);
        ref.setCheck(false);
        return ref;
    }
}
